package com.wlc.base.design.strategymode.v2_1;

/**
 * @author 王立朝
 * @date 2022/3/16
 * @description: 打折收费子类
 */
public class CashRebate extends CashSuper {

    /**打折收费的折扣率*/
    private double moneyRebate = 1d;

    /**
     * 打折收费，初始化时，必须要输入折扣率，
     * 如8折，就是0.8
     * @param moneyRebate
     */
    public CashRebate(String moneyRebate){
        this.moneyRebate = Double.parseDouble(moneyRebate);
    }
    /**
     * 接受现金的抽象方法
     *
     * @param money
     * @return
     */
    @Override
    public double acceptCash(Double money) {
        return money * moneyRebate;
    }
}
